home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------------------------------
-
- FILENAME
- RenderPageMessage.c
-
- DESCRIPTION
- This file contains the message procedure that will be invoked when the Printing Manager
- issues the RenderPage message. The routine which is called is RenderPageMessageProc.
- Depending upon the effects the user selected in the Addition's Print dialog panel,
- RenderPageMessageProc will invoke routines in the Additions.c file to produce the
- desired effects.
-
- COPYRIGHT
- Copyright Apple Computer, Inc. 1991
- All rights reserved.
-
- INTERFACE ROUTINES
- RenderPageMessageProc
-
- MODIFICATION HISTORY
- 05/15/91 ALA Initial Implementation
-
-
- ------------------------------------------------------------------------------- */
-
- #include <Types.h>
- #include <Quickdraw.h>
- #include <Memory.h>
- #include <Resources.h>
- #include <Dialogs.h>
- #include <TextEdit.h>
- #include <OSUtils.h>
- #include <Packages.h>
- #include <ToolUtils.h>
- #include <Menus.h>
- #include <String.h>
- #include <Strings.h>
- #include <Printing.h>
-
- #include <graphics routines.h>
- #include <graphics libraries.h>
- #include <Font Library.h>
-
- #include <Collections.h>
- #include <Messages.h>
-
- #include <PrintingManager.h>
- #include <PrintingMessages.h>
-
- #include "Utilities.h"
- #include "Additions.h"
-
-
- /*================================== MESSAGE INTERFACE ROUTINES ==================================*/
-
-
- /* ===== RenderPageMessageProc =====
-
- RenderPageMessageProc is the extension's routine which will be invoked when Printing issues a
- renderPage message. This routine checks to see if a serial number should be added
- to the page. If so, it will call SerializeCopies to generate and add a serial number shape
- to the page. Regardless of whether a serial number is added to the page, the routine calls
- Forward_RenderPage to render the page.
- */
- OSErr RenderPageMessageProc( // (out) Error code
- gxFormat theFormat, // (in) Format reference for the page being rendered
- gxShape thePage, // (in) The page shape being rendered
- gxPageInfoRecord *pageInfo, // (in) page info. describing the page
- void *imageData) // (in) image data generated
- {
- OSErr anErr = noErr;
- Collection jobCollection;
- AdditionsCollection additionsConfig;
-
- /* Get reference to the print Job's collection */
- jobCollection = GXGetJobCollection(GXGetJob());
-
- /* Fetch a handle to the Additions's collection we created at Print dialog time */
- anErr = GetCollectionItem (jobCollection,
- kAdditionsCollectionType,
- gxPrintingTagID,
- nil,
- &additionsConfig);
- if (anErr == noErr)
- {
- /* If we're serializing copies, add the serial number to the page shape */
- if (additionsConfig.serializeCopies)
- {
- SerializeCopies( thePage,
- theFormat,
- pageInfo->copyNum,
- &pageInfo->pageChanged,
- additionsConfig.nextEndSerialNum,
- GetCopiesFromJob(jobCollection));
- }
- }
- else // T => no config; don't do anything
- anErr = noErr;
-
- /* Pass the render page message on to others */
- anErr = Forward_GXRenderPage (theFormat, thePage, pageInfo, imageData);
-
- return(anErr);
- }
- /* RenderPageMessageProc */
-